# Contributor: Leo <thinkabit.ukim@gmail.com>
# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=cbindgen
# Please be VERY careful bumping this - Firefox regularly fails to build
# with new versions!
pkgver=0.26.0
pkgrel=0
pkgdesc="Tool to generate C bindings from Rust code"
url="https://github.com/eqrion/cbindgen"
arch="all"
license="MPL-2.0"
makedepends="cargo cargo-auditable"
checkdepends="cython"
source="$pkgname-$pkgver.tar.gz::https://crates.io/api/v1/crates/cbindgen/$pkgver/download"
options="net"

prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --release --frozen
}

check() {
	# Failing tests
	rm -rf tests/rust/expand*
	cargo test --frozen
}

package() {
	install -Dm0755 target/release/cbindgen -t "$pkgdir"/usr/bin
}

sha512sums="
2de81f46c9c68c985241a349f13125876667d1460d3658ead8c4ee9788cd139c30dbc08bebddc172cf0bd4644f3f17c02cf66f2a3ef706c52366fdaf0f9d8059  cbindgen-0.26.0.tar.gz
"
